﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Attendences.Framework.BusinessLogic;
using Attendences.Framework.Entity;

public partial class Page_UserAttendIndex : BaseAuthenticationPage
{
    protected DataTable AttendItemList
    {
        get
        {
            if (ViewState["AttendItemList"] == null)
                ViewState["AttendItemList"] = new DataTable();
            return ViewState["AttendItemList"] as DataTable;
        }
        set
        {
            ViewState["AttendItemList"] = value;
        }
    }

    public string SearchClause
    {
        get
        {
            if (ViewState["SearchClause"] == null)
                ViewState["SearchClause"] = "1=1";
            return ViewState["SearchClause"].ToString();
        }
        set
        {
            ViewState["SearchClause"] = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        SearchClause += string.Format("AND AttendenceID=(select max(AttendenceID) from AttendenceUser where");
        SearchClause += string.Format(" {0} = N'{1}')", AttendenceUser.SQLCOL_USERID, CurrentUser.ID);
        AttendItemList = BLAttendences.GetAttendenceItem(SearchClause);

        rptItemList.DataSource = AttendItemList;
        rptItemList.DataBind();
    }
}
